from requests import RequestException

from gis.common.retry import retry
from itpay.core.conf import IMConf
from itpay.utils import rpc


@retry(RequestException, tries=2)
def send_im_message_to_agency(agency_id, message):
    params = {"app_id": IMConf.app_id, "agency_id": agency_id, "message": message}

    rpc.do_post(
        IMConf.host + "open/pay/send_message_to_agency/", params, IMConf.api_key
    )
